package org.blogwu.learn.multithread.chapter6.class2;

import java.util.ArrayList;
import java.util.List;

public class ConstrMethodRef {

    @FunctionalInterface
    interface UserFactore<U extends User> {
        U create(int id, String name);
    }

    static UserFactore<User> uf = User::new;

    public static void main(String[] args) {
        List<User> users = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            users.add(uf.create(i, i + " he"));
        }

        users.stream().map(User::getName).forEach(System.out::println);

    }

}
